package com.wqj.kyee.gps.util;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.transition.Transition;
import android.transition.TransitionInflater;

import com.wqj.kyee.gps.R;

/**
 * Created by Administrator on 2017/12/15.
 */

public class BaseTransitionInActivity extends AppCompatActivity {
    public static final String EXTRA_TRANSITION = "EXTRA_TRANSITION";
    public static final String TRANSITION_FADE_FAST = "FADE_FAST";
    public static final String TRANSITION_FADE_SLOW = "FADE_SLOW";
    public static final String TRANSITION_SLIDE_RIGHT = "SLIDE_RIGHT";
    public static final String TRANSITION_SLIDE_BOTTOM = "SLIDE_BOTTOM";
    public static final String TRANSITION_EXPLODE = "EXPLODE";
    public static final String TRANSITION_EXPLODE_BOUNCE = "EXPLODE_BOUNCE";

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        String transition = getIntent().getStringExtra(EXTRA_TRANSITION);
        switch (transition) {
            case TRANSITION_SLIDE_RIGHT:
                Transition transitionSlideRight =
                        TransitionInflater.from(this).inflateTransition(R.transition.slide_right);
                getWindow().setEnterTransition(transitionSlideRight);
                break;
            case TRANSITION_SLIDE_BOTTOM:
                Transition transitionSlideBottom =
                        TransitionInflater.from(this).inflateTransition(R.transition.slide_bottom);
                getWindow().setEnterTransition(transitionSlideBottom);
                break;
            case TRANSITION_FADE_FAST:
                Transition transitionFadeFast =
                        TransitionInflater.from(this).inflateTransition(R.transition.fade_fast);
                getWindow().setEnterTransition(transitionFadeFast);
                break;
            case TRANSITION_FADE_SLOW:
                Transition transitionFadeSlow =
                        TransitionInflater.from(this).inflateTransition(R.transition.fade_slow);
                getWindow().setEnterTransition(transitionFadeSlow);
                break;
            case TRANSITION_EXPLODE:
                Transition transitionExplode =
                        TransitionInflater.from(this).inflateTransition(R.transition.explode);
                getWindow().setEnterTransition(transitionExplode);
                break;
            case TRANSITION_EXPLODE_BOUNCE:
                Transition transitionExplodeBounce =
                        TransitionInflater.from(this).inflateTransition(R.transition.explode_bounce);
                getWindow().setEnterTransition(transitionExplodeBounce);
                break;
        }
    }
}
